﻿using Abp.Web.Mvc.Authorization;
using FutureApp.Authorization;
using FutureApp.Shop;
using FutureApp.Web.Models.Shop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;

namespace FutureApp.Web.Controllers
{
    [AbpMvcAuthorize(PermissionNames.Pages_Goods)]
    public class GoodsMouldsController : FutureAppControllerBase
    {
        public IGoodsMouldAppService GoodsModelAppService { get; set; }
        public IGoodsAttributeAppService GoodsAttributeAppService { get; set; }

        public async Task<ActionResult> List()
        {
            var output = await this.GoodsModelAppService.GetGoodsMouldList();
            return this.View(output);
        }

        public async Task<ActionResult> Add()
        {
            var viewModel = new GoodsMouldiewModel
            {
                GoodsAttributes = (await this.GoodsAttributeAppService.GetGoodsAttributeList()).Items
            };
            return this.View(viewModel);
        }

        public async Task<ActionResult> Edit(Guid id)
        {
            var viewModel = new GoodsMouldiewModel
            {
                GoodsAttributes = (await this.GoodsAttributeAppService.GetGoodsAttributeList()).Items,
                CurrentGoodsMould = await this.GoodsModelAppService.GetGoodsMould(id)
            };
            return this.View(viewModel);
        }
    }
}